﻿/*  PandoraUnleashed
    An open source API for the Pandora music service
    Copyright © 2011 Saulius Milevicius

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PandoraUnleashed.Data;

namespace PandoraUnleashed
{
    enum TrackQuality
    {
        High,
        Medium,
        Low,
    }

    class Track
    {
        /// <summary>
        /// The tracks data
        /// </summary>
        public TrackData trackData { get; set; }

        /// <summary>
        /// Default constructor for a Track
        /// </summary>
        /// <param name="trackData">The tracks data</param>
        public Track(TrackData trackData)
        {
            this.trackData = trackData;
        }

        /// <summary>
        /// Get the url to the audio track
        /// </summary>
        /// <param name="trackQuality">The quality you would like</param>
        /// <returns>An url to the track of the selected quality</returns>
        public String getAudioUrl(TrackQuality trackQuality)
        {
            String url = "";
            if (trackQuality == TrackQuality.Low)
            {
                url = trackData.audioUrlMap["lowQuality"]["audioUrl"];
            }
            if (trackQuality == TrackQuality.Medium)
            {
                url = trackData.audioUrlMap["mediumQuality"]["audioUrl"];
            }
            if (trackQuality == TrackQuality.High)
            {
                url = trackData.audioUrlMap["highQuality"]["audioUrl"];
            }
            return url;
        }
    }
}
